{include file='_header'}
<style type="text/css">
.table_kf {display: none;width:100%}
.table_kf.active {display: table;}
</style>
<div class="page-header">
    当前位置：<span class="text-primary">商品管理</span>
</div>
<div class="page-content">
    <form action="" method="get" class="form-horizontal" plugins="form">
        <input type='hidden' id='tab' name='type' value="{$type}"/>
        <div class="page-toolbar m-b-sm m-t-sm">
            <div class="col-sm-6">
                <span class='pull-left'>
                    <a class='btn btn-primary btn-sm' href="{:url('admin/groups/goodsadd')}"><i class='fa fa-plus'></i> 添加商品</a>
                </span>
            </div>
            <div class="col-sm-6 pull-right">
                <div class="input-group">
                    <div class="input-group-select">
                        <select name="category" class='form-control' style="width:120px;">
                            <option value="" {if empty($category)}selected{/if} >商品分类</option>
                            {foreach name='categorys' item='cate'}
                            <option value="{$cate['id']}" {if $category==$cate['id']}selected{/if}>{$cate['name']}</option>
                            {/foreach}
                        </select>
                    </div>
                    <div class="input-group-select">
                        <select name='status' class='form-control  input-sm' style='width:100px;'>
                            <option value='' {if $status==''}selected{/if}>状态</option>
                            <option value='0' {if $status=='0'}selected{/if}>下架</option>
                            <option value='1' {if $status=='1'}selected{/if} >上架</option>
                        </select>
                    </div>
                    <input type="text" class="input-sm form-control" name='keyword' value="{$_GET['keyword']}" placeholder="请输入关键词">
                    <span class="input-group-btn">
                        <button class="btn btn-primary" type="submit">搜索</button>
                    </span>
                </div>
            </div>
        </div>
        <ul class="nav nav-arrow-next nav-tabs" id="myTab" >
            <li class="{if $type=='sale' || empty($type)}active{/if}" >
                <a href="{:url('admin/groups/goods',array('type'=>sale))}">出售中 (<span class='goods-ing'>-</span>)</a>
            </li>
            <li class="{if $type=='sold'}active{/if}" >
                <a href="{:url('admin/groups/goods',array('type'=>sold))}">已售罄 (<span class='goods-sold'>-</span>)</a>
            </li>
            <li class="{if $type=='store'}active{/if}" >
                <a href="{:url('admin/groups/goods',array('type'=>store))}">仓库中 (<span class='goods-store'>-</span>)</a>
            </li>
            <li class="{if $type=='recycle'}active{/if}">
                <a href="{:url('admin/groups/goods',array('type'=>recycle))}">回收站 (<span class='goods-recycle'>-</span>)</a>
            </li>
        </ul>
    </form>
    <form action="" method="post">
        <div class="table_kf {if $type=='sale' || empty($type)}active{/if}" id="tab_sale">{include file='groups/goods/sale'}</div>
        <div class="table_kf {if $type=='sold'}active{/if}" id="tab_sold">{include file='groups/goods/sold'}</div>
        <div class="table_kf {if $type=='store'}active{/if}" id="tab_store">{include file='groups/goods/store'}</div>
        <div class="table_kf {if $type=='recycle'}active{/if}" id="tab_recycle">{include file='groups/goods/recycle'}</div>

    </form>
</div>
<script type="text/javascript">
$(function(){
    /*
     * 出售中 1 已售罄 2 仓库中 3 回收站 4
     * */
    $.getJSON("{:url('admin/groups/goodstotal');}",{ type: "1"},function(json){
        $(".goods-ing").text(json);
        $.getJSON("{:url('admin/groups/goodstotal');}",{ type: "2"},function(json){
            $(".goods-sold").text(json);
            $.getJSON("{:url('admin/groups/goodstotal');}",{ type: "3"},function(json){
                $(".goods-store").text(json);
                $.getJSON("{:url('admin/groups/goodstotal');}",{ type: "4"},function(json){
                    $(".goods-recycle").text(json);
                });
            });
        });
    });
})
</script>
{include file='_footer'}
